package com.plane;

import javax.imageio.ImageIO;
import java.awt.*;
import java.io.IOException;

public class Map extends Sprite {
    public static final int MAP_WIDTH = 480;
    public static final int MAP_HEIGHT = 652;

    public Map() {
        this.yStep = 7;

        try {
            image = ImageIO.read(Map.class.getResourceAsStream("background.png"));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public void move() {
        y += yStep;
        if (y > MAP_HEIGHT) {
            y = 0;
        }
    }

    public void paint(Graphics gTmp, GamePanel gp) {
        //gTmp.drawImage(image,x,y,gp);
        gTmp.drawImage(image, x, y, gp);
        gTmp.drawImage(image, x, y - MAP_HEIGHT, gp);
    }
}
